home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Printer Drivers… / LaserWriterIIsc (New GX v1.1) / UniversalMessageResources.r < prev    next >
Encoding:
Text File  |  1995-04-10  |  17.0 KB  |  508 lines  |  [TEXT/MPS ]

  1. /* ------------------------------------------------------------------------------
  2. FILENAME
  3.     NewAPIResources.r
  4.  
  5. DESCRIPTION
  6.     This module contains the LaserWriter SC constants, types, and resources that
  7.     are specific to supporting the New (QuickDraw GX) API.
  8.             
  9.     Note: all resources should be designated to load into the system heap.
  10.  
  11. COPYRIGHT
  12.      Copyright Apple Computer, Inc. 1988-1992
  13.      All rights reserved. 
  14.     
  15. -------------------------------------------------------------------------------- */
  16.  
  17. // System 7.0 Compatible
  18. #define SystemSevenOrLater        1
  19.  
  20. // Include System Resource Definitions
  21. #include "Types.r"
  22. #include "SysTypes.r"
  23.  
  24. // Include the LaserWriter SC driver constants that are used in the resources 
  25. #include "LaserSCResources.h"
  26.  
  27. // Include the public QuickDraw GX printing files 
  28. #include "PrintingResTypes.r"
  29.  
  30.  
  31. /*********************************************************************************
  32.  *                                RESOURCES                                                              *
  33.  *********************************************************************************/
  34.  
  35.  
  36. /*************************** Universal Imaging Message Override Resource **************************/
  37. // This overrideType resource tells the Printing Manager which new Universal Imaging 
  38. // Messages the driver overrides. 
  39.  
  40. resource gxOverrideType (gxDriverUniversalOverrideID, sysheap)
  41. {
  42.     {
  43.         gxInitialize,            kNewAPISegmentID, kFirstMsgJumpTableOffset,
  44.         gxShutDown,             kNewAPISegmentID, kFirstMsgJumpTableOffset +  4,
  45.         gxSetupPageImageData,kNewAPISegmentID, kFirstMsgJumpTableOffset +  8,
  46.         gxSetUpImageData,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 12,
  47.         gxOpenConnection,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 16,
  48.         gxCloseConnection,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 20,
  49.         gxStartSendPage,         kNewAPISegmentID, kFirstMsgJumpTableOffset + 24,
  50.         gxFinishSendPage,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 28,
  51.         gxDefaultPrinter,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 32,
  52.         gxWriteData,             kNewAPISegmentID, kFirstMsgJumpTableOffset + 36,
  53.         gxCheckStatus,            kNewAPISegmentID, kFirstMsgJumpTableOffset + 40,
  54.         gxGetDeviceStatus,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 44,
  55.         gxCreateImageFile,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 48,
  56.         gxFetchTaggedData,    kNewAPISegmentID, kFirstMsgJumpTableOffset + 52,
  57.         gxDoesPaperFit,        kNewAPISegmentID, kFirstMsgJumpTableOffset + 60
  58.     };
  59. };
  60.  
  61.  
  62. /*************************** Raster Imaging Message Override Resource **************************/
  63. // This overrideType resource tells the Printing Manager which Raster Imaging Messages the driver 
  64. // overrides. 
  65.  
  66. resource gxOverrideType (gxDriverImagingOverrideID, sysheap)
  67. {
  68.     {
  69.         gxRasterDataIn,     kNewAPISegmentID, kFirstMsgJumpTableOffset + 56
  70.     };
  71. };
  72.  
  73.  
  74. /*************************** Type of Imaging System Supported by the Driver **************************/
  75. // This imagingSystemResType resource tells the Printing Manager the type of imaging system this 
  76. // driver uses.
  77.  
  78. resource gxImagingSystemSelectorType (gxImagingSystemSelectorID, sysheap)
  79. {
  80.     gxRasterPrinterType        // LaserWriter SC uses the raster imaging system 
  81. };
  82.  
  83.  
  84. /*************************** Customizing Behavior of Raster Imaging Messages ***************************/
  85. // For most raster devices, the driver should include a resource of type, rasterPrefsType.  This 
  86. // resource allows the driver to specify the imaging options and format page scaling.  Since 
  87. // the Printing Manager default rasterPrefsType resource is defined for a 1 bit, 300 dpi device, 
  88. // the LaserWriter SC driver uses this default. 
  89.  
  90.  
  91. /*************************** I/O Related Resources ***************************/
  92.  
  93. // This universalIOPrefsType resource controls the behavior of the standard buffering and IO 
  94. // within the Universal Driver. 
  95.  
  96. resource gxUniversalIOPrefsType (gxUniversalIOPrefsID, sysheap)
  97. {
  98.         standardIO,
  99.         0,                // Universal Driver will not allocate any buffers 
  100.         0,                // size of the buffers allocated (N/A) 
  101.         10,            // number of I/O request blocks to allocate for the Universal Driver's I/O 
  102.         1200,            // 1200 tick timeout for open/close 
  103.         1200,            // 1200 tick timeout for reading and writing 
  104. };
  105.     
  106.  
  107. /*************************** Status Dialog Related Resources ***************************/
  108. // The 'stat' resources provide the Printing Manager the status messages that need to be displayed at
  109. // any given time during the printing process. The driver forces statuses to be displayed by calling 
  110. // either ReportStatus or AlertTheUser, depending upon whether the user needs to make some decision 
  111. // about the printing process (e.g. paper tray not properly loaded. Note that though the statID field
  112. // of the 'stat' resource is for the clients use (us), PrinterShare requires that any 'stat' list
  113. // entry that has the same status type (e.g. informationalStatus) must have a unique statID.  The reason
  114. // is that PrinterShare uses the (status type, statID) pair in comparisons to see if the status has
  115. // changed.
  116.  
  117. resource 'stat' (kTransmissionStatID, sysheap)         // Page transmission 'stat' - informational messages only 
  118. {
  119.     kDrvrCreatorType,
  120.     {
  121.         informationalStatus,     1,        kNoAlertCoolID,                 "Waiting for the next sheet of paper…";
  122.         informationalStatus,        2,        kNoAlertCoolID,                "Sending part of the page…";
  123.         informationalStatus,        3,        kNoAlertCoolID,                "Preparing part of the page…";
  124.         informationalStatus,     4,        kNoAlertCoolID,                 "The printer is out of paper.";
  125.         informationalStatus,     5,        kNoAlertCoolID,                 "The printer has a paper jam.";
  126.         informationalStatus,     6,        kNoAlertCoolID,                "The paper tray is improperly loaded.";
  127.         userAlert,                     7,     kPrinterDoorOpenCoolID,        "The printer door is open.  Please close it.";
  128.         informationalStatus,     8,     kNoAlertCoolID,                "The printer door is open.  Please close it.";    //    Non-alert instance of the status
  129.         informationalStatus,     9,     kNoAlertCoolID,                "A print test is in progress.  Please wait…";
  130.         informationalStatus,     10,    kNoAlertCoolID,                "The printer fixing unit is being heated.  Please wait…";
  131.         userAlert,                    11,    kBadTonerCartridgeCoolID,    "The toner cartridge is improperly loaded.";
  132.         informationalStatus,        12,    kNoAlertCoolID,                "The toner cartridge is improperly loaded.";        //    Non-alert instance of the status
  133.         pageTransmission,             13,    kNoAlertCoolID,                "Printing the page.";
  134.         userAlert,                     14,    kCantFindPrinterCoolID,        "Trying to locate the printer…";
  135.         openConnectionStatus,     15,    kNoAlertCoolID,                "Opening a connection to the printer…";
  136.     }
  137. };
  138.  
  139. resource 'stat' (kEngineStatusStatID, sysheap)        // Printer engine status 'stat' - fatal errors 
  140. {
  141.     kDrvrCreatorType,
  142.     {
  143.         userAlert,            1,    kLaserInitFailureCoolID,    "Laser Printer engine initialization failed.";
  144.         userAlert,            2,    kDRamFailureCoolID,            "Dynamic Ram test failure.";
  145.         userAlert,             3,    kBadPrintFixCoolID,             "The printer fixing assembly has malfunctioned.";
  146.         userAlert,             4,    kBadLaserCoolID,                 "The printer laser has malfunctioned.";
  147.         userAlert,             5,    kBadPolyMotorCoolID,         "The printer polygon motor has malfunctioned.";
  148.         userAlert,             6,    kBadSerialCoolID,             "The printer has a serial communication malfunction.";
  149.         userAlert,             7,    kGenericBadHdwareCoolID,     "The printer has a hardware malfunction.";
  150.         userAlert,            8, kBadVersionAlertID,            "Printer driver requires QuickDraw™ GX version 1.1 or later.";
  151.     }
  152. };
  153.  
  154.  
  155.  
  156. // Following are the gxPrintingAlertType alert definitions which are used to notify the user of FATAL printing errors. 
  157.  
  158. // This is our "this driver requires QDGX 1.1" alert.
  159.  
  160. resource gxPrintingAlertType (kBadVersionAlertID, sysheap)
  161. {
  162.     printingStatus,                                            // version 
  163.     stopIcon,                                                    // icon id 
  164.     defaultSystemSize,
  165.     defaultAction,                                                // the default label 
  166.     noCancelTitle,                                                // haven't got a cancel 
  167.     "The “LaserWriterIISC GX” printer driver "
  168.     "cannot be used because it requires "
  169.     "QuickDraw™ GX version 1.1 or later.",             // text string 
  170.     "Cancel",                                                    // action label 
  171.     "",                                                            // button label 2 
  172.     "",                                                            // button label 3 
  173.     " ",                                                            // font name 
  174.     "Printer Driver Version Error"
  175. };
  176.  
  177.  
  178. // ...and this is what we use if we're running from the Chooser instead of the Finder.
  179.  
  180. resource 'dctb' (kBadVersionDLOG, sysheap) {
  181.     {}
  182. };
  183.  
  184. resource 'ALRT' (kBadVersionDLOG, sysheap) {
  185.     {40, 40, 162, 392},
  186.     kBadVersionDLOG,
  187.     {
  188.         OK, visible, sound1,
  189.         OK, visible, sound1,
  190.         OK, visible, sound1,
  191.         OK, visible, sound1
  192.     },
  193.     alertPositionParentWindow
  194. };
  195.  
  196. resource 'DITL' (kBadVersionDLOG, sysheap) {
  197.     {
  198.         {92, 281, 112, 339},
  199.         Button {
  200.             enabled,
  201.             "OK"
  202.         },
  203.         {8, 80, 74, 345},
  204.         StaticText {
  205.             disabled,
  206.             "The printer driver “^0” cannot be used "
  207.             "because it requires QuickDraw™ GX version "
  208.             "1.1 or later."
  209.         }
  210.     }
  211. };
  212.  
  213.  
  214. resource gxPrintingAlertType (kLaserInitFailureCoolID, sysheap)        // Laser Printer initialization failed 
  215. {
  216.     printingStatus,                                                // version 
  217.     stopIcon,                                                    // icon id 
  218.     defaultSystemSize,
  219.     defaultAction,                                                // the default label 
  220.     noCancelTitle,                                                // haven't got a cancel 
  221.     "The document !1 failed to print, because the printer !0 failed to initialize.",            // text string 
  222.     "Cancel Printing",                                        // action label 
  223.     "",                                                            // button label 2 
  224.     "",                                                            // button label 3 
  225.     " ",                                                            // font name 
  226.     "Printer Failure"
  227. };
  228.  
  229.  
  230. resource gxPrintingAlertType (kDRamFailureCoolID, sysheap)        // Dynamic Ram test failure 
  231. {
  232.     printingStatus,                                                    // version 
  233.     stopIcon,                                                    // icon id 
  234.     defaultSystemSize,
  235.     defaultAction,                                                // the default label 
  236.     noCancelTitle,                                                // haven't got a cancel 
  237.     "The document !1 failed to print, because the printer !0 experienced a dynamic RAM failure.",    // text string 
  238.     "Cancel Printing",                                        // action label 
  239.     "",                                                            // button label 2 
  240.     "",                                                            // button label 3 
  241.     " ",                                                            // font name 
  242.     "Printer Failure"
  243. };
  244.  
  245.  
  246. resource gxPrintingAlertType (kBadPrintFixCoolID, sysheap)         // printer fixing assembly bad 
  247. {
  248.     printingStatus,                                                    // version 
  249.     stopIcon,                                                    // icon id 
  250.     defaultSystemSize,
  251.     defaultAction,                                                // the default label 
  252.     noCancelTitle,                                                // haven't got a cancel 
  253.     "The document !1 failed to print, because the fixing assembly in the printer !0 has malfunctioned.",  // text string 
  254.     "Cancel Printing",                                        // action label 
  255.     "",                                                            // button label 2 
  256.     "",                                                            // button label 3 
  257.     " ",                                                            // font name 
  258.     "Printer Failure"
  259. };
  260.  
  261. resource gxPrintingAlertType (kBadLaserCoolID, sysheap)         // laser bad 
  262. {
  263.     printingStatus,                                                    // version 
  264.     stopIcon,                                                    // icon id 
  265.     defaultSystemSize,
  266.     defaultAction,                                                // the default label 
  267.     noCancelTitle,                                                // haven't got a cancel 
  268.     "The document !1 failed to print, because the laser in the printer !0 has malfunctioned.",    // text string 
  269.     "Cancel Printing",                                        // action label 
  270.     "",                                                            // button label 2 
  271.     "",                                                            // button label 3 
  272.     " ",                                                            // font name 
  273.     "Printer Failure"
  274. };
  275.  
  276. resource gxPrintingAlertType (kBadPolyMotorCoolID, sysheap)         // polygon motor bad 
  277. {
  278.     printingStatus,                                                    // version 
  279.     stopIcon,                                                    // icon id 
  280.     defaultSystemSize,
  281.     defaultAction,                                                // the default label 
  282.     noCancelTitle,                                                // haven't got a cancel 
  283.     "The document !1 failed to print, because the polygon motor in the printer !0 has malfunctioned.",    // text string 
  284.     "Cancel Printing",                                        // action label 
  285.     "",                                                            // button label 2 
  286.     "",                                                            // button label 3 
  287.     " ",                                                            // font name 
  288.     "Printer Failure"
  289. };
  290.  
  291. resource gxPrintingAlertType (kBadSerialCoolID, sysheap)         // serial communication bad 
  292. {
  293.     printingStatus,                                                    // version 
  294.     stopIcon,                                                    // icon id 
  295.     defaultSystemSize,
  296.     defaultAction,                                                // the default label 
  297.     noCancelTitle,                                                // haven't got a cancel 
  298.     "The document !1 failed to print, because a serial communication malfunction has occurred in the printer !0.",    // text string 
  299.     "Cancel Printing",                                        // action label 
  300.     "",                                                            // button label 2 
  301.     "",                                                            // button label 3 
  302.     " ",                                                            // font name 
  303.     "Printer Failure"
  304. };
  305.  
  306. resource gxPrintingAlertType (kGenericBadHdwareCoolID, sysheap)         // unidentified hardware malfunction 
  307. {
  308.     printingStatus,                                                    // version 
  309.     stopIcon,                                                    // icon id 
  310.     defaultSystemSize,
  311.     defaultAction,                                                // the default label 
  312.     noCancelTitle,                                                // haven't got a cancel 
  313.     "The document !1 failed to print, because the printer !0 experienced an unknown hardware malfunction.",    // text string 
  314.     "Cancel Printing",                                        // action label 
  315.     "",                                                            // button label 2 
  316.     "",                                                            // button label 3 
  317.     " ",                                                            // font name 
  318.     "Printer Failure"
  319. };
  320.  
  321. // Following are the gxPrintingAlertType alert definitions which are used to notify the user of NON-FATAL printing errors. 
  322.  
  323. resource gxPrintingAlertType (kPrinterDoorOpenCoolID, sysHeap)            //    The printer's door is open so we can't print
  324. {
  325.     printingStatus,                                                                // version
  326.     cautionIcon,                                                            // icon id
  327.     defaultSystemSize,
  328.     defaultAction,                                                            // the default label
  329.     cancelTitle2,                                                            // second button is cancel
  330.      "The printer door on the printer !0 is open.  To "        // text string
  331.      "continue printing !1, please close the door and "        // text string
  332.      "click Continue.  If you wish to cancel printing, "       // text string
  333.      "please click Cancel Printing.",                                   // text string
  334.      "Continue",                                                                // action label
  335.     "Cancel Printing",                                                    // button label 2
  336.     "",                                                                        // button label 3
  337.     " ",                                                            // font name 
  338.     "Printer Failure"
  339. };
  340.  
  341. resource gxPrintingAlertType (kBadTonerCartridgeCoolID, sysHeap)        //    The printer's toner cartridge is not inserted properly
  342. {
  343.     printingStatus,                                                                // version
  344.     cautionIcon,                                                            // icon id
  345.     defaultSystemSize,
  346.     defaultAction,                                                            // the default label
  347.     cancelTitle2,                                                            // second button is cancel
  348.      "The toner cartridge in the printer !0 is improperly "    //
  349.     "loaded.  To continue printing !1, please re-install "    //
  350.     "the cartridge properly and click Continue.  "
  351.      "If you wish to cancel printing, "                               // text string
  352.      "please click Cancel Printing.",                                   // text string
  353.      "Continue",                                                                // action label
  354.     "Cancel Printing",                                                    // button label 2
  355.     "",                                                                        // button label 3
  356.     " ",                                                                        // font name 
  357.     "Printer Failure"
  358. };
  359.  
  360. resource gxPrintingAlertType (kCantFindPrinterCoolID, sysHeap)            //    The printer can't be found on the SCSI bus
  361. {
  362.     printingStatus,                                                                // version
  363.     cautionIcon,                                                            // icon id
  364.     defaultSystemSize,
  365.     defaultAction,                                                            // the default label
  366.     noCancelTitle,                                                            // no cancel
  367.     "The document !1 cannot be printed, because the printer "
  368.      "!0 cannot be found.  To continue printing, please make "
  369.     "sure the printer is "
  370.     "properly connected and turned on.  If you wish "    
  371.     "to cancel printing, please click Cancel Printing.",
  372.      "Cancel Printing",                                                    // action label
  373.     "",                                                                        // button label 2
  374.     "",                                                                        // button label 3
  375.     " ",                                                                        // font name 
  376.     "Printer Not Found"
  377. };
  378.  
  379.  
  380. /*************************** Paper Type Definitions for the New Printing Architecture **************************/
  381. // These paper type definitions represent the new settings for the LaserWriter SC's paper 
  382. // sizes. 
  383.  
  384. resource 'ptyp' (kNewPaperTypesID + 1, sysheap)            // US Letter 
  385. {
  386.     "US Letter",
  387.     
  388.     // page rectangle 
  389.     0x00000000,                // 8.0 x 10.583
  390.     0x00000000,                
  391.     0x02400000,                
  392.     0x02F9F9B8,                
  393.  
  394.     // paper rectangle 
  395.     0xFFEE0000,                // 8.5 x 11.0
  396.     0xFFF0FCDC,                
  397.     0x02520000,                
  398.     0x0308FCDC,                
  399.     
  400.     usLetterBase,
  401.     kDrvrCreatorType,
  402.  
  403.     inch,
  404.     newStylePaperType,
  405.     isDefaultPaperType,
  406.     {}
  407. };
  408.  
  409. resource 'ptyp' (kNewPaperTypesID + 2, sysheap)            // US Legal 
  410. {
  411.     "US Legal",
  412.     
  413.     // page rectangle 
  414.     0x00000000,                // 6.67 x 12.5
  415.     0x00000000,                
  416.     0x01E03D68,                    
  417.     0x03840000,                
  418.  
  419.     // paper rectangle 
  420.     0xFFBE1EB4,                // 8.5 x 14.0
  421.     0xFFCA0000,                
  422.     0x02221EB4,                
  423.     0x03BA0000,                
  424.     
  425.     usLegalBase,
  426.     kDrvrCreatorType,
  427.  
  428.     inch,
  429.     newStylePaperType,
  430.     notDefaultPaperType,
  431.     {}
  432. };
  433.  
  434. resource 'ptyp' (kNewPaperTypesID + 3, sysheap)            // A4 Letter 
  435. {
  436.     "A4 Letter",
  437.     
  438.     // page rectangle 
  439.     0x00000000,                // 8.0 x 11.25 
  440.     0x00000000,
  441.     0x02400000,
  442.     0x032A0000,
  443.  
  444.     // paper rectangle 
  445.     0xFFF70000,                //    8.25 x 11.6667
  446.     0xFFF0FFAC,
  447.     0x02490000,
  448.     0x03390054,
  449.     
  450.     a4LetterBase,
  451.     kDrvrCreatorType,
  452.  
  453.     inch,
  454.     newStylePaperType,
  455.     notDefaultPaperType,
  456.     {}
  457. };
  458.  
  459. resource 'ptyp' (kNewPaperTypesID + 4, sysheap)            // B5 Letter 
  460. {
  461.     "B5 Letter",
  462.     
  463.     // page rectangle 
  464.     0x00000000,                // 6.6667 x 9.4167 
  465.     0x00000000,                
  466.     0x01DFC290,                
  467.     0X02C251EC,                
  468.  
  469.     // paper rectangle 
  470.     -0x14A3D7,                // 6.9306 x 9.8333
  471.     -0x73338,                
  472.     0x01F46667,                
  473.     0x02C98524,                
  474.     
  475.     b5LetterBase,
  476.     kDrvrCreatorType,
  477.  
  478.     inch,
  479.     newStylePaperType,
  480.     notDefaultPaperType,
  481.     {}
  482. };
  483.  
  484. resource 'ptyp' (kNewPaperTypesID + 5, sysheap)            // Nº 10 Envelope 
  485. {
  486.     "Nº 10 Envelope",
  487.     
  488.     // page rectangle 
  489.     0x00000000,                    // 9.083 x 3.78 
  490.     0x00000000,                    
  491.     0x011028F0,                    
  492.     0x028DF9B8,                    
  493.     
  494.     // paper rectangle 
  495.     0xFFF39478,                    // 9.5 x 4.125 
  496.     0xFFF0FCDC,                    
  497.     0x011C9478,                    
  498.     0x029CFCDC,                    
  499.     
  500.     unknownBase,
  501.     kDrvrCreatorType,
  502.  
  503.     inch,
  504.     newStylePaperType,
  505.     notDefaultPaperType,
  506.     {}
  507. };
  508.